Skip to content

Increased test coverage #644

Merged
marvin-hansen merged 8 commits into
deepcausality-rs:mainfrom
marvin-hansen:main
Jun 22, 2026
Merged

Increased test coverage #644
marvin-hansen merged 8 commits into
deepcausality-rs:mainfrom
marvin-hansen:main

Conversation

@marvin-hansen

@marvin-hansen marvin-hansen commented Jun 22, 2026

Copy link
Copy Markdown
Member

Describe your changes

Increased test coverage across multiple crates.

Issue ticket number and link

Closes #638

Code checklist before requesting a review

  • I have signed the DCO?
  • All tests are passing when running make test?
  • No errors or security vulnerabilities are reported by make check?

For details on make, please see BUILD.md

Note: The CI runs all of the above and fixing things before they hit CI speeds
up the review and merge process. Thank you.


Summary by cubic

Increase test coverage across deep_causality, deep_causality_algorithms, and deep_causality_physics. Adds targeted tests for error paths, default trait bodies, and edge-case branches; no production code changes.

  • Test Coverage

    • deep_causality: tests for error conversions and sources; default Adjustable/UncertainAdjustable; collection aggregation and short-circuit paths (incl. UncertainF64); graph guards (frozen add, unfrozen or identical-node shortest-path); space-time interval time-scale conversions; model/interpreter defaults; applicative no-value branch; utils aggregate non-Value errors.
    • deep_causality_algorithms: BRCD empty-config/None-plan and non-finite scoring; GST cached-removal replay; SURD level-raising and zero-entropy cases (base and CDL); DAG sampling branch coverage; MRMR non-finite first-feature; SURD utils marginal zero entries.
    • deep_causality_physics: kernel and wrapper error arms across astro, condensed, dynamics, EM, fluids, MHD, nuclear, photonics, quantum, relativity, thermodynamics, and waves; finiteness/clamp checks; small PDG and quantity constructor/accessor tests.
  • Build/Test Config

    • Bazel: add tests/error suite and wire new test modules under deep_causality_physics/tests/BUILD.bazel.

Written for commit 4719e8a. Summary will update on new commits.

Review in cubic

- add default-method tests for Adjustable/UncertainAdjustable traits
- cover CausalAction::action() and Model's Identifiable::id() trait impl
- cover ActionError->CausalityError and CsmError::Uncertain source arms
- cover monadic_collection_utils non-Value / missing-threshold error paths
- cover GraphGeneratableEffect apply no-value/no-error branch
- cover Interpreter Default impl and no-context / poisoned-lock evolve paths
- cover get_shortest_path start==stop and unfrozen-graph arms; add_causaloid
  frozen-graph error; collection aggregation-Err (stateless and stateful);
  stateful collection incoming-error and empty-collection arms
- cover InferableReasoning::all_non_inferable true arm via a mock Inferable
- net: 244 -> 155 uncovered lines in deep_causality/src; remaining lines are
  dead/unexported code, defensive guards, unreachable!() phantom arms, and
  error paths unconstructible via the public API

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Add tests covering previously untested modules (tests only; no
production source changes beyond wiring a #[cfg(test)] mod):
- algebra: Group/Abelian, Ring, and Module (scale) trait impls
- arithmetic: identity (zero/one) and Neg for owned and &ref tensors
- ops: tensor_svd_decomp power iteration, non-contiguous reshape
  (tensor_shape), tensor_product, tensor_reduction, tensor_stack,
  tensor_inverse, and ein_sum diagonal/trace paths
- getters/get_ref, to-conversions, display, ext_hkt, ext_stats

Remaining uncovered lines are unreachable defensive guards, documented:
- tensor_inverse:85 — div-by-zero shadowed by the earlier relative
  singular-matrix check (pivot == max_val > tol >= epsilon)
- tensor_reduction:127 — AxisOutOfBounds shadowed by sum_axes' own
  axis validation, which runs first
- tensor_shape:42/54 — defensive index guard and rank>0 false edge
  (non-contiguous tensors always have rank >= 2)
- tensor_svd_decomp:73/113 — zero-norm guards unreachable given the
  positive deterministic v init and normalized u
- ein_sum_impl:404 — if-let-None merge for an always-valid batch index

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
…argeted branch tests

- brcd: cover None-plan/empty-config path (acyclic CPDAG with no valid cut),
  non-2D tensor guard, pairwise candidate enumeration, non-positive Dirichlet
  concentration, and directed-arc cpdag_key collection
- surd: cover the monotonicity level-raise body in both the base and CDL paths
- dag_sampling: add permutation-stress and equal_to_vec batteries; prove the
  remaining forbidden-prefix breaks, post-orientation cycle guards, and
  WeightedChoice fallthrough unreachable for valid chordal/CPDAG input
- document all residual lines as unreachable/defensive exceptions
  (feature-gated parallel paths, guards shadowed by earlier validation,
  invariant shape/cycle guards, llvm-cov generic-stub artifacts)
- tests only; no source changes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
… the rest

- Cover 4 reachable defensive guards with real tests:
  - astro/wrappers schwarzschild_radius error arm (negative mass → Length::new)
  - fluids/coherent_structures lambda2 upper r_val clamp (scanned gradient)
  - quantum/gates_haruna exp non-finite-delta guard (overflow sweep)
  - relativity/spacetime time_dilation gamma clamp (identical-vector rounding)
- Document the 157 remaining uncovered lines as defensively unreachable:
  infallible R::from_f64 closures, always-Ok kernels/constructors, and guards
  shadowed by earlier validation (with per-line NOTE blocks in the test files).
- Fix 3 pre-existing clippy -D warnings in test files by rewriting test code
  (unnecessary_unwrap, single-pattern match, identity_op).
- Tests only; no non-test source changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
…t defensive remainder

- adjunction-Stokes: cover exterior-derivative column-bound guard and the
  boundary lookup-miss arm via short-coefficient and partial-chain tests
- gauge witness: cover the scalar (0-d) connection single-point default in
  both abelian and non-abelian field-strength kernels using a custom
  SPACETIME_DIM=1, LIE_ALGEBRA_DIM=1 abelian group
- simplicial complex: cover empty-complex hodge_star_operators fast path and
  the previously-unused create_test_tensor helper
- manifold covariance: add 1x1 success-path tests for covariance/eigen
- remaining uncovered lines are documented exceptions: from_f64 conversion
  arms (never fail for f64/f32), zero-extent lattice guards, writeln! ?-Err
  regions, redundant guards shadowed by earlier validation, constructor-
  prevented empty states, the f64-sqrt undershoot guard (proven unreachable),
  if-let merge-brace region artifacts, and degenerate-geometry branches gated
  by validated inputs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
Signed-off-by: Marvin Hansen <marvin.hansen@gmail.com>
@marvin-hansen marvin-hansen self-assigned this Jun 22, 2026
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.56%. Comparing base (8aa6616) to head (4719e8a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #644      +/-   ##
==========================================
+ Coverage   96.09%   97.56%   +1.47%     
==========================================
  Files        1114     1114              
  Lines       57243    57243              
==========================================
+ Hits        55005    55851     +846     
+ Misses       2238     1392     -846     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 173 files

Note: This PR contains a large number of files. cubic only reviews up to 100 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.

Re-trigger cubic

@marvin-hansen marvin-hansen merged commit 4535544 into deepcausality-rs:main Jun 22, 2026
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Increase test coverage

1 participant